<?php
/**
 * Abstract class representing a table in a database.
 */
abstract class OORDBTable implements IteratorAggregate
{
	/**
	 * Get a single row from the table.
	 * @param mixed $id Primary key of row
	 * @return OORDBWrapper Row wrapper class
	 */
	abstract public function get( $id );
	
	/**
	 * Get a list of all rows from the database.
	 * @return Iterator Iterator across a list of OORDBWrapper classes.
	 */
	abstract public function getAll();
	
	/**
	 * Get the name of the table.
	 * @return string Name of table
	 */
	abstract public function getName();
	
	/**
	 * Get the names of table fields.
	 * @return array Array of field names.
	 */
	abstract public function getFields();
	
	/**
	 * Get the database this table belongs to.
	 * @return OORDBDatabase Parent database
	 */
	abstract public function getDatabase();
	
	/**
	 * Get a list of all rows from the database.
	 * @return Iterator Iterator across a list of OORDBWrapper classes.
	 */
	public function getIterator()
	{
		return $this->getAll();
	}
}
?>